package com.example.demo.infra.repository.impl;

import com.example.demo.api.dto.EmployeeDTO;
import com.example.demo.domain.entity.Employee;
import com.example.demo.domain.repository.EmployeeRepository;
import com.example.demo.infra.mapper.EmployeeMapper;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public class EmployeeRepositoryImpl implements EmployeeRepository {
    private final EmployeeMapper employeeMapper;

    public EmployeeRepositoryImpl(EmployeeMapper employeeMapper) {
        this.employeeMapper = employeeMapper;
    }

    @Override
    public List<Employee> findEmployeeByCondition(EmployeeDTO employee) {
        return employeeMapper.findEmployeeByCondition(employee);
    }

    @Override
    public Employee findEmployeeById(Long employeeId) {
        return employeeMapper.findEmployeeById(employeeId);
    }

    @Override
    public Integer countEmployeeLen() {
        return employeeMapper.countEmployeeLen();
    }

    @Override
    public Integer insertEmployee(EmployeeDTO employee) {
        return employeeMapper.insertEmployee(employee);
    }

    @Override
    public Integer removeEmployee(Long employeeId) {
        return employeeMapper.removeEmployee(employeeId);
    }

    @Override
    public Integer updateEmployee(EmployeeDTO employee) {
        return employeeMapper.updateEmployee(employee);
    }
}
